Repository navigation
fix: send a padded list, area or heading name trimmed when only that form matches - #456
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Things matches a
--list,--areaor--headingtitle without trimming it, so--list " Tools "used to put the to-do in the Inbox, with only a warning. The CLI's lookups (db.AddTarget,db.AreaTarget,db.HeadingTarget) do the same, so they warned correctly but did not help.Now
add,project add,editandproject editchoose the name to send like this:Errands, is still reached by typing"Errands ".Toolsgoes asToolsand lands with no warning.The lookup and the send now always use the same name. The helpers are
addTargetNameandareaTargetNameincmd/things/names.go.editapplies the rule to the heading too, both when it comes with a--list/--list-idand when it is looked up alone in the to-do's own project.importdoes not trim. Its payload is Things' own format and goes as given, and it still warns about a padded name. commands.md, agents.md and SKILL.md say so.Tests
TestTargetNamesSentTrimmedWhenOnlyThatMatcheschecks the URL that is sent for add, project add, edit and project edit. It covers padded names that only match trimmed, real padded titles (sent as given), and unknown names (sent as given, with a warning). On main it fails for every trimmed case.TestAddWarnsOnUnresolvedListOrHeading,TestProjectAddWarnsOnUnknownAreaandTestEditWarnsOnUnresolvedMove, the padded cases now expect no warning and the right filing. ThepaddedTitlecases are unchanged and pass./code-review
--list-idpath ineditnow goes throughaddTargetName, so a padded heading sent with--list-idis trimmed too (new caseeditListIDHeading); there is no heading retry when the list is an area, which has no headings.editquotes the heading as typed, even when it will be sent trimmed (wording only). A padded list plus a padded heading can run one extra heading query (fixing it means changingdb.AddTarget).resolveAddTarget/projectAreareturn the names through pointer parameters; returning them would be clearer but is only a matter of style.